# -*- coding:UTF-8 -*- #

import os
from configparser import ConfigParser
import pymongo

class Commons:
    def __init__(self):
       confpath = os.path.dirname(os.path.abspath(__file__)) + "/conf.cfg"
       self.conf = ConfigParser()
       self.conf.read(confpath)
       self.sections = self.conf.sections()

    def conMongo(self):
        dbname = self.conf.get('db', 'dbname')
        host = self.conf.get('db', 'host')
        conn = pymongo.MongoClient(host, 27017)

        db = conn.dbname
        my_db = db.test

        return my_db;
